package com.sgxy.service.impl;

import com.sgxy.entity.DocumentInf;
import com.sgxy.mapper.DocumentInfMapper;
import com.sgxy.service.DocumentInfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DocumentInfServiceImpl implements DocumentInfService {
    private final DocumentInfMapper documentInfMapper;
    @Autowired
    public DocumentInfServiceImpl(DocumentInfMapper documentInfMapper) {
        this.documentInfMapper = documentInfMapper;
    }

    @Override
    public int AddDocumentInf(DocumentInf documentInf) {
        int i = documentInfMapper.insertSelective(documentInf);
        return i;
    }

    @Override
    public int DeleteDocumentInf(Integer id) {
        int i = documentInfMapper.deleteByPrimaryKey(id);
        return i;
    }

    @Override
    public void DeleteDocumentInf(List<Integer> ids) {
        documentInfMapper.deleteDocumentInf(ids);
    }

    @Override
    public int UpdateDocumentInf(DocumentInf documentInf) {
        int i = documentInfMapper.updateByPrimaryKeySelective(documentInf);
        return i;
    }

    @Override
    public DocumentInf QueryDocumentInf(Integer id) {
        DocumentInf documentInf = documentInfMapper.selectByPrimaryKey(id);
        return documentInf;
    }

    public List<DocumentInf> QueryDocumentInfs(DocumentInf documentInf) {
        List<DocumentInf> documentInfs = documentInfMapper.queryDocumentInfs(documentInf);
        return documentInfs;
    }

    @Override
    public List<DocumentInf> QueryAllDocumentInfs() {
        List<DocumentInf> documentInfs = documentInfMapper.selectAll();
        return documentInfs;
    }
}
